GINO Graphics Suite - GINOGRAF v9.5  

Step Chart Components

There are four components available for the building of a fully annotated, filled Step Chart:

ggBlockFillStepChart() Drawing block filled step chart
ggAddStepChartOutline() Drawing step or column outline
ggFillStepChart() Drawing filled steps
ggAddStepChartValues() Displaying step values

All four routines may be used independently of each other or on the same chart although it is usual to use a combination of block filling and values, or simple filling, outline and values. It is necessary to define both X and Y axis positions and data ranges before calling any of these routines either by the axis definition routines or the Complete Chart Drawing routine ggPlotStepChart().

Users should note that if ggFillStepChart() is called after ggPlotStepChart() or ggAddStepChartOutline() the Step Chart outline will be overwritten by the filling. If the outline is required, the solution is to always draw the outline with ggAddStepChartOutline() after the filling. The block filling routine fills the appropriate areas and follows this with drawing the bar chart outline in the current GINO line colour.

Block Filled Step Chart

The routine to display a block filled step chart is:

ggBlockFillStepChart(nsteps,steps,base,xory,line)

This routine displays a set of data values as block filled columns on the last defined set of axes. The columns are of various widths being between the values supplied in the array steps. Each column is filled between the height value in the same array and the constant value base. The argument xory determines whether the columns are oriented with the heights against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis.

All the blocks are solid filled with the specified line style with the extrusions filled with a darker (or lighter) shade of this line style according to the current block chart attributes (using ggSetBlockChartAttribs()).

The following shows an example of a block filled step chart.

Block Filled Step Chart

Step Chart Outline

The routine to display a set of steps is:

ggAddStepChartOutline(nsteps,steps,base,drop,xory)

This routine displays a set of data values as steps or columns on the last defined set of axes. The start, finish and height values of each step are held in the array steps (of type GSTEPCHART). The argument xory determines whether the heights are plotted against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis.

An optional base value can also be supplied where the steps are required to descend to a fixed value. The use of base is in conjunction with the argument drop which determines the form of the Step Chart display such that where drop=GDROPTYPE0 or GDROPTYPE1, base is not required, but where drop=GDROPTYPE2 or GDROPTYPE3, base is required.

The four Step Chart forms are shown below:

Step Chart forms

Step Chart Filling

The routine to display a set of filled steps is:

ggFillStepChart(nsteps,steps,base,xory,fill,line)

This routine displays a set of data values as filled columns on the last defined set of axes. The columns are of various widths being between the values supplied in the array steps (of type GSTEPCHART). Each column is filled between the height value in the same array and the constant value base. The argument xory determines whether the columns are oriented with the heights against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis. When using ggFillStepChart() in conjunction with ggPlotStepChart(), xory should be set to GXAXIS.

The hatch or fill style for each column is held in the array fill. Various hatches and cross hatches as well as solid fill are available. If an element of fill contains a number less than -1 (GHOLLOW), the corresponding column is not filled and the boundary not drawn. The line styles used to fill the columns are held in the array line. The default line styles, hatch styles and fill styles appear in Appendix A of this manual (see Defaults). Further information on line style definition (which includes colour definition) and information on hatch and fill style definition appears in the main introduction.

The step outlines are not drawn with this routine. Users should use ggPlotStepChart() or ggAddStepChartOutline() to draw the outline.

Annotating Step Charts

The routine to annotate a Step Chart is:

ggAddStepChartValues(nsteps,steps,base,sfl,xory) 

where ggAddStepChartValues() will display nsteps values associated with the Step Chart drawn by ggPlotStepChart() or ggAddStepChartOutline(). The argument sfl provides the choice of displaying five different values: 

sfl= GSTART start value of each step
  GFINISH finish value of each step
  GHEIGHT height value of each step
  GWIDTH width of each step
  GHEIGHTABOVEBASE height above base of each step

By default, the values are positioned at the centre of the associated column (ie, between the height in steps and the base value) in the same numerical format as their associated axis. The numerical format of the data values can be changed through the routine ggSetAxesAnnotation() with xory set appropriately.

The user can select alternative positions and formatting options by using the annotation control routines (see Histogram Components). The 15 control point positions around the Step Chart areas are located in the same logical position irrespective of the data limits or the axis direction. These routines also provide for string angle and justification control as well as prefix and/or suffix strings added to each value.

Although the step outline is not drawn with this routine is it necessary to set the correct orientation of the columns to ensure the values are correctly positioned. This is determined by the argument xory such that when xory=GXAXIS the height of the column is oriented against the vertical axis and when xory=GYAXIS the height of the column is oriented against the horizontal axis. When using ggAddStepChartValues() in conjunction with ggPlotStepChart(), xory should be set to GXAXIS.

Example of Fully Annotated Step Chart

The following example shows the use of all the Step Chart component routines:

Fully annotated Step Chart

[C/C++]
/* FULLY ANNOTATED STEP CHART */
#include <gino-c.h>
#include <graf-c.h>

int main(void) {
   GSTEPCHART steps[7] = {0.0,20.0,153.0,20.0,30.0,145.0,
       30.0,60.0,161.0,60.0,80.0,154.0,80.0,100.0,130.0,
       100.0,130.0,126.0,170.0,200.0,112.0};
   GCHASTY rep;
   GLIMIT lims;
   int i, flg, fill[7], line[7];
   for (i=0; i<7; i++) {
        fill[i]=4;
        line[i]=1;
   }
   gOpenGino();
   xxxxx();
   ggSetGraphCharMode(GGINOMODE);
/* ENQUIRE GINOGRAF DRAWING LIMITS AND CHARACTER SIZE */
   ggEnqPlotFrame(&flg,&lims); 
   gEnqCharAttribs(&rep);  
/* SET UP AXES POSITIONS AND SCALES */
   ggSetAxesPos(GAXISSTART,9.0*rep.width,
       5.0*rep.height,lims.xmax-lims.xmin-12.0*rep.width,GXAXIS);
  ggSetAxesScaling(GLINEARTYPE1,11,0.0,200.0,GXAXIS);  
  ggSetAxesPos(GAXISSTART,9.0*rep.width,
       5.0*rep.height,lims.ymax-lims.ymin-10.0*rep.height,GYAXIS);  
   ggSetAxesScaling(GLINEARTYPE1,10,0.0,180.0,GYAXIS);  
/* DRAW STEP CHART */
   ggFillStepChart(7,steps,0.0,GXAXIS,fill,line);
   ggAddStepChartOutline(7,steps,0.0,GDROPTYPE3,GXAXIS);
/* POSITION START VALUES AT LEFT EDGE OF COLUMN AT 90 DEGREES */
   ggSetValueAttribs(GINSIDELEFT,GOUTSIDETOP,
       0.0,0.0,0.0,90.0,GCENTRE,GLEFT);
   ggAddStepChartValues(7,steps,0.0,GSTART,GXAXIS);
/* POSITION FINISH VALUES AT RIGHT EDGE OF COLUMN AT 90 DEGREES */
   ggSetValueAttribs(GINSIDERIGHT,GOUTSIDETOP,
       0.0,0.0,0.0,90.0,GCENTRE,GLEFT);
   ggAddStepChartValues(7,steps,0.0,GFINISH,GXAXIS);
/* DRAW GRID */
   ggAddGrid(GNONE,GNONE,GANNOTATION,GANNOTATION);  

   gSuspendDevice();
   gCloseGino();
   return(0);
}
[F90]
! FULLY ANNOTATED STEP CHART
use gino_f90
use graf_f90

  type (GSTEPCHART), dimension(7) :: steps = &
    (/GSTEPCHART(0.0,20.0,153.0),GSTEPCHART(20.0,30.0,145.0), &
      GSTEPCHART(30.0,60.0,161.0), &
      GSTEPCHART(60.0,80.0,154.0), &
      GSTEPCHART(80.0,100.0,130.0), &
      GSTEPCHART(100.0,130.0,126.0), &
      GSTEPCHART(170.0,200.0,112.0)/)
  type (GCHASTY) rep
  type (GLIMIT) lims
  integer i, flg
  integer, dimension(7) :: fill = (/7*4/)
  integer, dimension(7) :: line = (/7*1/)
  call gOpenGino
  call xxxxx
  call ggSetGraphCharMode(GGINOMODE)
! ENQUIRE GINOGRAF DRAWING LIMITS AND CHARACTER SIZE
  call ggEnqPlotFrame(flg,lims)
  call gEnqCharAttribs(rep)
! SET UP AXES POSITIONS AND SCALES
  call ggSetAxesPos(GAXISSTART,9.0*rep%width, &
       5.0*rep%height,lims%xmax-lims%xmin-12.0*rep%width,GXAXIS)
  call ggSetAxesScaling(GLINEARTYPE1,11,0.0,200.0,GXAXIS)  
  call ggSetAxesPos(GAXISSTART,9.0*rep%width, &
       5.0*rep%height,lims%ymax-lims%ymin-10.0*rep%height,GYAXIS)
  call ggSetAxesScaling(GLINEARTYPE1,10,0.0,180.0,GYAXIS)  
! DRAW STEP CHART
  call ggFillStepChart(7,steps,0.0,GXAXIS,fill,line)
  call ggAddStepChartOutline(7,steps,0.0,GDROPTYPE3,GXAXIS)
! POSITION START VALUES AT LEFT EDGE OF COLUMN AT 90 DEGREES
  call ggSetValueAttribs(GINSIDELEFT,GOUTSIDETOP,
       0.0,0.0,0.0,90.0,GCENTRE,GLEFT)
  call ggAddStepChartValues(7,steps,0.0,GSTART,GXAXIS)
! POSITION FINISH VALUES AT RIGHT EDGE OF COLUMN AT 90 DEGREES
  call ggSetValueAttribs(GINSIDERIGHT,GOUTSIDETOP, &
       0.0,0.0,0.0,90.0,GCENTRE,GLEFT)
  call ggAddStepChartValues(7,steps,0.0,GFINISH,GXAXIS)
! DRAW GRID
  call ggAddGrid(GNONE,GNONE,GANNOTATION,GANNOTATION)

  call gSuspendDevice
  call gCloseGino
  stop
  end